package org.ds.auth;

import javax.security.auth.login.LoginContext;

/**
 * A simple test class that instantiates a LoginContext and calls the login
 * method on the LoginContext object. The purpose of this test class is to
 * verify the authentication functionality of the customized login module
 * specified by the "DalalStreet" entry in jaas.conf.
 * 
 * @author Kartick Suriamoorthy
 */

public class TestAuthentication
{

	public static void main(String[] args)
	{
		try
		{
			LoginContext lc = new LoginContext("DalalStreet", new DSCallbackHandler());

			lc.login();

			System.out.println("Successfully logged in !!");

		}
		catch (Throwable t)
		{
			System.out.println("Caught an exception. Error message : " + t.getMessage());
			t.printStackTrace();
		}
	}

}
